Skip to content

feat(openclaw-plugin): compress oversized tool results during context assembly#1014

Open
yjjheizhu wants to merge 1 commit intovolcengine:mainfrom
yjjheizhu:feat/openclaw-tool-context-compression
Open

feat(openclaw-plugin): compress oversized tool results during context assembly#1014
yjjheizhu wants to merge 1 commit intovolcengine:mainfrom
yjjheizhu:feat/openclaw-tool-context-compression

Conversation

@yjjheizhu
Copy link
Copy Markdown

Summary

  • compress oversized toolResult messages during OpenClaw context-engine assemble()
  • keep session transcripts unchanged while shrinking the prompt actually sent to the model
  • add plugin config and UI/schema support for tool-context compression tuning

What changed

  • add tool-result compression helpers in examples/openclaw-plugin/context-engine.ts
  • wire compression into assemble() before returning context messages
  • add config fields in config.ts
  • add matching uiHints and configSchema fields in openclaw.plugin.json

Default behavior

  • enabled for oversized results from exec, process, web_fetch, and browser
  • keeps key error/warn lines and essential metadata
  • leaves read disabled by default to avoid hiding useful file content
  • does not rewrite transcript history; only affects assembled context

Notes

  • this PR intentionally does not include our separate local-startup improvements, to keep scope focused on context compression
  • our local validation showed large prompt-size savings after compression during assemble()

@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Mar 26, 2026

CLA assistant check
All committers have signed the CLA.

@github-actions
Copy link
Copy Markdown

Failed to generate code suggestions for PR

@Mijamind719 Mijamind719 self-requested a review March 30, 2026 13:47
@Mijamind719
Copy link
Copy Markdown
Collaborator

Thanks for your submission. This part of the code has been refactored in the main branch. Could you please implement this feature based on the latest code?

@Mijamind719 Mijamind719 self-assigned this Mar 31, 2026
@jcp0578
Copy link
Copy Markdown
Contributor

jcp0578 commented Mar 31, 2026

good suggestion

  1. Could this support configurable allow / skip lists for tool compression? That would make it easier to adapt to similar tools exposed under different names in different runtimes.
  2. The current name-based approach is reasonable as an initial implementation. As a follow-up improvement, it may be worth considering message-characteristic-based detection for better robustness.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

4 participants